package com.ml.mall.mapper.coupon;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ml.mall.bean.res.coupon.CouponProductRes;
import com.ml.mall.entity.coupon.SysCouponSupplierUnuseProduct;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysCouponSupplierUnuseProductMapper extends BaseMapper<SysCouponSupplierUnuseProduct> {
    /**
     * @description    :根据优惠券id查询未使用优惠券的产品
     * @author         :zxm
     * @date           :2021/5/24
    **/
    List<CouponProductRes> selectUnuseProductByCouponCode(@Param("couponCode") String couponCode);

    /**
     * @description    :根据优惠券id删除
     * @author         :zxm
     * @date           :2021/5/24
    **/
    @Delete("delete from sys_coupon_supplier_unuse_product where coupon_code = #{couponCode} ")
    int deleteByCouponCode(@Param("couponCode") String couponCode);
}